/**
 * Created by liubin on 2017/4/12.
 */


var WhmjCardPlace = function(){
    var that = {};

    //扣牌大小
    that.kouSelectBoxSize = cc.size(0, 0);

    //手牌大小
    that.inhandCardSize = cc.size(109, 168);

    //手牌缩放
    that.inhandCardScale = 1;

    //开口牌缩放
    that.openCardScale = 1;

    //手牌两边间隔
    that.inhandCardJiange = 30;

    //手牌间隔
    that.inhandCardOffset = 1;

    //---------
    //对家 up
    //---------

    that.upInhandCardSize = cc.size(109, 168);

    that.upOpenCardSize = cc.size(109, 168);

    that.upInhandCardScale = 1;

    that.upDealScale = 1;

    that.upOpenCardScale = 1;

    that.upInhandCardJiange = 150;

    that.upInhandCardOffset = 0;

    that.upInhandCardOffsetLast = 15;

    that.upInhandRect = cc.rect(0, 0, 0, 0);

    //其他玩家手牌大小
    that.leftInhandCardSize = cc.size(84, 109);

    //其他玩家开口牌大小
    that.leftOpenCardSize = cc.size(134, 126);

    //其他玩家手牌缩放
    that.leftInhandCardScale = 1;

    //其他玩家翻开手牌缩放
    that.leftInhandShowCardScale = 1;

    //其他玩家开口牌缩放
    that.leftOpenCardScale = 1;

    //其他玩家出牌区域
    that.leftInhandRect = cc.rect(0, 0, 0, 0);

    //其他玩家手牌间隔
    that.leftInhandCardOffset = 0;

    //其他玩家最后一张手牌间隔
    that.leftInhandCardOffsetLast = 15;

    //打出牌大小
    that.dealScale = 1;
    that.leftDealScale = 1;

    //初始化
    that.init = function(){
        //手牌缩放
        var width = mo.gameSize.x - that.inhandCardJiange * 2 - that.inhandCardOffset * 13;
        var oneWidth = width / 14;
        that.inhandCardScale = oneWidth / that.inhandCardSize.width;
        that.openCardScale = that.inhandCardScale - 0.1;

        //扣牌大小
        var cardSize = that.inhandCardSize;
        that.kouSelectBoxSize = cc.size((cardSize.width * that.inhandCardScale + that.inhandCardOffset) * 3, cardSize.height * that.inhandCardScale);

        //up
        that.upInhandRect = cc.rect(0, mo.gameSize.y - 40, 505, 0);
        oneWidth = (that.upInhandRect.width - that.upInhandCardOffset * 13 - that.upInhandCardOffsetLast) / 14;

        that.upInhandRect.x = (mo.gameSize.x - (oneWidth + that.upInhandCardOffset) * 13)/ 2;

        that.upInhandCardScale = oneWidth / that.upInhandCardSize.width;
        that.upOpenCardScale = that.upInhandCardScale - 0.1;

        that.upInhandShowCardScale = 43 / that.leftOpenCardSize.width;
        that.upOpenCardScale = 36 / that.leftOpenCardSize.width;

        // width = mo.gameSize.x - that.upInhandCardJiange * 2 - that.upInhandCardOffset * 13;
        // oneWidth = width / 14;
        // that.upInhandCardScale = oneWidth / that.upInhandCardSize.width;
        // that.upOpenCardScale = that.upInhandCardScale - 0.1;

        //其他玩家手牌缩放
        that.leftInhandRect = cc.rect(125, 160, 0, 435);
        oneWidth = (that.leftInhandRect.height - that.leftInhandCardOffset * 13 - that.leftInhandCardOffsetLast) / 14;
        that.leftInhandCardScale = oneWidth / that.leftInhandCardSize.height;
        that.leftInhandShowCardScale = 43 / that.leftOpenCardSize.width;
        that.leftOpenCardScale = 36 / that.leftOpenCardSize.width;

        //打出牌大小
        that.dealScale = 44 / that.inhandCardSize.width * 0.7;
        that.leftDealScale = 50 / that.leftOpenCardSize.width  * 0.7;
        that.upDealScale = that.dealScale * 0.9;
    };

    return that;
};